/*
 * boundMailBox.cpp
 *
 *  Created on: Jun 22, 2009
 *      Author: ortal
 */

#include "BoundMailBox.h"

BoundMailBox::BoundMailBox(int size):UnBoundMailBox(-1)
{
	_boundSize = size;
}

BoundMailBox::~BoundMailBox()
{

}


/// add check if queue is full, sleep wait etc.
void BoundMailBox::addFirst(Message* msg)
{
	vector<Message*>::iterator iter = _waiting_msgs.begin();
	_waiting_msgs.insert(iter, msg);
}

void BoundMailBox::addLast(Message* msg)
{
	_waiting_msgs.push_back(msg);
//	cout<<"MSG ADDED"<<endl;
//	cout<<"size now: "<<_waiting_msgs.size()<<endl;
}


bool BoundMailBox::isFull()
{
	return _boundSize == _waiting_msgs.size();
}
